package com.hz.learnboot.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Spring Boot 启动类
 *
 * config配置文件名称必须是：bootstrap.properties
 *
 * Created by hezhao on 28/06/2018.
 */
@SpringBootApplication
@RestController
@EnableEurekaClient
@RefreshScope
public class ConfigClientApplication {

	/**
	 * 重新载入配置文件
	 * http://localhost:8777/actuator/bus-refresh
	 */

	@Value("${name}")
	private String name;

	@GetMapping("/")
	public String getName(){
		return name;
	}

	public static void main(String[] args) {
		SpringApplication.run(ConfigClientApplication.class, args);
	}
}
